import 'package:flutter/material.dart';
import "MovieCardList.dart";

/// 影视系列item
class MovieSeriesItem {
  final String title;
  final String cover;
  MovieSeriesItem({required this.title, required this.cover});
}

/// 影视系列
class MovieSeries extends StatelessWidget {
  final String seriesTitle; //系列标题
  final String? seriesLogo; //系列logo
  final String seriesCover; //系列背景图
  final String? url; //系列跳转链接
  final List<MovieCard> items; //系列item
  final Color linearGradientColor; //系列背景底部渐变色
  const MovieSeries({
    super.key,
    required this.items,
    required this.seriesTitle,
    this.seriesLogo = '',
    required this.seriesCover,
    this.url,
    required this.linearGradientColor,
  });

  @override
  Widget build(BuildContext context) {
    // 尺寸按父容器
    return Stack(
      children: [
        Container(
          width: double.infinity,
          height: double.infinity,
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage(seriesCover),
              fit: BoxFit.cover,
            ),
          ),
        ),
        Container(
          width: double.infinity,
          height: double.infinity,
          decoration: BoxDecoration(
            gradient: LinearGradient(
              begin: Alignment.bottomCenter,
              end: Alignment.topCenter,
              colors: [
                linearGradientColor,
                linearGradientColor,
                Colors.transparent,
                Colors.transparent,
              ],
            ),
          ),
        ),
        Column(
          mainAxisAlignment: MainAxisAlignment.end,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Padding(
              padding: const EdgeInsets.fromLTRB(12, 10, 12, 10),
              child: Text(
                seriesTitle,
                style: const TextStyle(
                  color: Colors.white,
                  fontWeight: FontWeight.bold,
                  fontSize: 18,
                ),
              ),
            ),
            MovieCardList(
              cardList: items,
              size: CardSize.small,
              showSubTitle: false,
              titleColor: Colors.white,
            )
          ],
        )
      ],
    );
  }
}
